# -*- coding: UTF-8 -*-
import copy


#based on swap
def insertionSort(data):
    for i in range(0, len(data)):
        j = i
        while j > 0 and data[j - 1] > data[j]:
            data[j], data[j - 1] = data[j - 1], data[j]
            j -= 1
    return data

def bubbleSort(data):
    for i in range(len(data), 1, -1):
        for j in range(1, i):
            if data[j - 1] > data[j]:
                data[j - 1], data[j] = data[j], data[j - 1]
    return data

def selectionSort(data):
    for i in range(0, len(data)):
        p = i
        for j in range(i + 1,len(data)):
            if data[j] < data[p]:
                p, j = j, p
        if p != i:
            data[p], data[i] = data[i], data[p]
    return data
